/**
 * 平台管理员
 *
 * username 用户名
 * password 密码
 * avatar 头像
 * nickname
 * created_at
 * modified_at
 * deleted_at
 */
export interface Manager {
  username: string;
  password: string;
  avatar: string;
  nickname: string;
  created_at: Date;
  modified_at: Date;
  deleted_at?: Date;
}
/**
 * 性别
 */
export type Gender = "men" | "women";
/**
 * 消费用户
 *
 * nickname 昵称
 * email 电邮地址
 * password
 * avatar 头像
 * mobile 电话
 * birthday 生日
 */
export interface Customer {
  nickname: string;
  email: string;
  avatar: string;
  password: string;
  mobile: string;
  birthday: string;
  gender: Gender;
}

export type AddressType = "home" | "office" | "other";
/**
 * 地址
 *
 * city 省市区
 * contact 联系人
 * mobile 电话
 * detail 详细地址
 * isDefault 是否默认地址
 * customer 用户
 * deleted_at
 */
export interface Address {
  city: string;
  contact: string;
  mobile: string;
  detail: string;
  isDefault: boolean;
  customer: Customer;
  deleted_at: Date;
  type: AddressType;
}
/**
 * 衣服尺寸
 *
 */
export type Size = "S" | "M" | "L" | "XL" | "XXL" | "3XL";
/**
 * 商品分类
 *
 * name 名称
 * description 简述
 * picture 展示图
 * cover 封面
 * icon 图标
 * parent 父级分类
 */
export interface Category {
  name: string;
  description?: string;
  picture: string;
  cover: string;
  icon: string;
  parent?: Category;
}
/**
 * 商品颜色
 *
 * name 名称
 *
 */
export interface Color {
  name: string;
  color: string;
}
/**
 * 产品
 *
 * name 名称
 * code 编号
 * description 简述
 * material 面料
 * ratings 评级
 * brand 品牌
 * sizes 尺寸 -> [S,M,L]
 * colors 颜色
 * price 当前价格
 * discount 当前折扣
 * category 分类
 */
export interface Product {
  name: string;
  code: string;
  description: string;
  material: string;
  ratings: number;
  brand: string;
  sizes: Size[];
  colors: Color[];
  imgs: string[];
  price: number;
  discount: number;
  category: Category;
  created_at: Date;
  created_by: Manager;
  deleted_at?: Date;
  deleted_by?: Manager;
  modified_at?: Date;
  modified_by?: Manager;
}

/**
 * 库存
 *
 * product 产品
 * size 尺寸
 * color 颜色
 * quantity 数量
 */
export interface Stock {
  product: Product;
  size: Size;
  color: Color;
  quantity: number;
}
/**
 * 入库单
 *
 * product 产品
 * size
 * color
 * quantity 数量 允许负数
 * date_on 入库日期
 * handler 经手人
 * created_at
 * created_by
 */
export interface StockOrders {
  product: Product;
  size: Size;
  color: Color;
  quantity: number;
  date_on: Date;
  created_at: Date;
  created_by: Manager;
  handler: string;
}
/**
 * 用户评价
 *
 * customer
 * product
 * size
 * color
 * buy_at 购买时间
 * up 点赞数
 * down 点踩数
 * created_at
 */
export interface Reviews {
  customer: Customer;
  product: Product;
  size: Size;
  color: Color;
  buy_at: Date;
  description: string;
  up: number;
  down: number;
  created_at: Date;
}

/**
 * 优惠卷
 *
 * num 编号
 * amount 金额
 * created_at
 * written_off 核销订单
 */
export interface Coupon {
  num: string;
  amount: number;
  written_off: Orders;
  created_at: Date;
  created_by: Manager;
}

/**
 * 支付类型
 *
 * weChat 微信
 * aliPay 支付宝
 */
export type Payment = "weChat" | "aliPay";

/**
 * 客户订单
 *
 * num 编号
 * created_at 创建时间
 * total 实付金额
 * savings 折扣金额
 * coupon 优惠卷
 * delivery_num 配送单号
 * delivery_at 配送时间
 * taken_at 收货时间
 * payment 支付类型
 * address 收货地址
 */
export interface Orders {
  num: string;
  created_at: Date;
  total: number;
  savings: number;
  coupon: Coupon;
  freight?: number;
  delivery_num: string;
  delivery_at: Date;
  delivery_company: string;
  taken_at: string;
  address: Address;
  payment: Payment;
  deleted_at: Date;
}

/**
 * 订单明细
 *
 * production: 商品
 * size: 尺寸
 * quantity: 数量
 * discount: 折扣
 * price: 单价
 * orders: 所属订单
 */
export interface OrderDetails {
  product: Product;
  size: Size;
  quantity: number;
  price: number;
  discount: number;
  orders: Orders;
}

/**
 * 购物车
 *
 * product 产品
 * size
 * color
 * quantity 数量
 * customer 用户
 */
export interface Cart {
  product: Product;
  size: Size;
  color: Color;
  quantity: number;
  customer: Customer;
}
/**
 * 心愿单
 *
 * product 产品
 * size
 * color
 * customer
 * created_at
 */
export interface WishList {
  product: Product;
  size: Size;
  color: Color;
  customer: Customer;
  created_at: Date;
}
